package com.huizu.common.utils;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.atomic.AtomicInteger;

public class UniqueStringGenerator {
    private static final String DATE_FORMAT = "yyyyMMddHHmmss";
    private static final AtomicInteger counter = new AtomicInteger(0);

    public static synchronized String generateUniqueString() {
        SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT);
        String dateString = dateFormat.format(new Date());
        int count = counter.getAndIncrement();
        return dateString + String.format("%03d", count);
    }

    public static void main(String[] args) {
        for (int i = 0; i < 10; i++) {
            System.out.println(generateUniqueString());
        }
    }
}
